Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W3C Compliance #81

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

W3C Compliance #81

wants to merge 5 commits into from

Conversation

fatadel
Copy link

@fatadel fatadel commented Mar 22, 2021

This is an indermediate PR (thus it's a draft yet) to share my work with @sebastiankb, @benfrancis and @tim-hellhake.

What is already done:

  1. Renamed links => forms;
  2. Renamed mediaType => type;
  3. Object wrappers removed from request/response of Property. Object wrapper is also removed from request of Action, but allowed wrapping payload inside value field (the same as in node-wot). The response of Action is currently not touched because it's not quite clear what to do with it.
  4. rel field is removed from all interaction affordances and op is added instead with respective operations.

Some open questions:

  • What to do with the top-level links? Currently, they are just renamed to forms.
  • What are the next steps?
  • I've also left some open questions in code as TODOs.

FYI, I've managed to consume and interact with (read/write properties and invoke action) the single-thing of webthing from a consumer in node-wot). The other behaviour (e.g. events) is not yet tested.

@benfrancis
Copy link
Member

@fatadel Thanks very much for sharing this early PR! @tim-hellhake is welcome to review it and decide what branch to eventually land on.

As expected, it seems there are several open questions shared with the gateway implementation which need resolving before we can be sure of what to do with some features. Let's try to resolve those issues on the gateway first, in the issues tagged with w3c-compliance.

@benfrancis
Copy link
Member

Following up on this after a long time, the master branch of WebThings Gateway is now more or less compliant with WoT Thing Description 1.1 and WoT Profile (HTTP Basic Profile and HTTP SSE Profile). That can provide a guide as to how to make all the WebThings Framework libraries like this one compliant.

What to do with the top-level links? Currently, they are just renamed to forms.

  • The top level properties, actions and events links should become forms with op values of readallproperties, writemultipleproperties, observeallproperties, unobserveallproperties, queryallactions, subscribeallevents, or unsubscribeallevents as appropriate
  • The top level link with "rel": "alternate" and mediaType": "text/html" should remain but mediaType should be renamed to type
  • The top level link with rel=alternate and a WebSocket URL should remain a link for now, see Change WebSocket endpoints from links to forms in Thing Descriptions gateway#2882

What are the next steps?

I would ideally like to implement both the HTTP Basic Profile and HTTP SSE Profile in all the WebThings Framework libraries, so that all WebThings web thing implementations are consistent with the gateway.

Object wrapper is also removed from request of Action, but allowed wrapping payload inside value field (the same as in node-wot)

This sounds wrong from this description, the action input should be mapped directly onto the body of the invokeaction POST request, e.g. see https://w3c.github.io/wot-profile/#example-13

The response of Action is currently not touched because it's not quite clear what to do with it.

WebThings Gateway doesn't currently expose any action outputs, but that could be implemented. Note that the HTTP Basic Profile has different response payloads for synchronous vs. asynchronous actions https://w3c.github.io/wot-profile/#sync-action-response

I've also left some open questions in code as TODOs.

TODO: The assumption is that all properties are at least readable - but that's probably not true

You're correct, see writeOnly in the Thing Description DataSchema. WebThings Gateway doesn't currently expose any write-only properties, see WebThingsIO/gateway#3082

"""Handle a request to /actions.""" # TODO: Should this feature be removed?

See queryallactions in the HTTP Basic Profile

"""Handle a request to /actions/<action_name>/<action_id>.""" # TODO: Should this feature be removed?

See queryaction and cancelaction in the HTTP Basic Profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants